<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" th:href="@{/res/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/res/css/admin.css}"/>
    <script th:src="@{/js/jquery-1.11.3.min.js}"></script>
    <script th:src="@{/myplugs/js/plugs.js}"></script>

</head>

<body>
<div class="admin-content-body">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单商品</strong><small></small></div>
    </div>

    <hr>

    <div class="am-g">
        <div class="am-u-sm-12">
            <form class="am-form">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-id">ID</th>
                        <th class="table-title">商品名</th>
                        <th class="table-style">长*宽*高</th>
                        <th class="table-weight">重量(kg)</th>
                        <th class="table-model">型号</th>
                        <th class="table-price">价格</th>
                        <th class="table-warranty_time">保修期</th>
                    </tr>
                    </thead>

                    <tbody id="mytbody">

                    </tbody>

                </table>
            </form>
        </div>
    </div>
</div>
</body>

<script>
    var result=new Object();
    result=getParameter();
    var oid=result["oid"];
    console.log(oid);

    /*获取URL*/
    function getParameter(){
        var url = location.search;
        var theRequest = new Object();
        if(url.indexOf("?") != -1){
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i <strs.length; i++){
                theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    };

    $.ajax({
        type:'POST',
        url:'/order/orderGoods',
        dataType:'json',
        data:{oid:oid},
        success:function (mydata) {
            console.log(mydata);
            showData(mydata);
        },
        error:function () {
            alert("error");
        }
    });
    function showData(data) {
        var str= "";
        for(var i = 0; i <data.length; i++){
            str = "<tr><td>"  + data[i].id + "</td><td>" + data[i].title + "</td><td>"
                + data[i].length + "*" + data[i].width + "*" + data[i].height + "</td><td>"
                + data[i].weight + "</td><td>" + data[i].model + "</td><td>" + data[i].price + "</td><td>" + data[i].warrantyTime + "</td></tr>";
            $("#mytbody").append(str);
        }
    };
</script>
</html>